@extends('WShop::layout')
@section('content')
    @include('WShop::public.header')
    <div class="mui-content mui-scroll-wrapper" id="pullrefresh">
        <div class="mui-scroll">
            <div class="mui-table-view mui-table-view-chevron mui-bottom">
                <div class="mui-queren-dingdan ">
                    <form id="order-create" action="{{route('f_Wap_Order_createOrder')}}" method="post">
                        {{csrf_field()}}

                        <ul class="mui-table-view bg-fff">

                            <li class="mui-table-view-cell" style="margin-bottom: 0!important;">
                                <a class="mui-navigate-right mui-clearfix" href="javascript:;">
                                    <img src="{{asset(config('view.frontend.wap_login').'/images/tu33.png')}}" alt="" width="25" class="mui-pull-left" />
                                    @if($address)
                                        <div class="mui-pull-left">
                                            <div>收件人：{{$address->consignee}}</div>
                                            <div>{{get_address($address->area)}}-{{$address->address}}</div>
                                        </div>
                                        <input type="hidden" name="address" value="{{$address->id}}">
                                    @else
                                        <div class="mui-pull-left tianjia" style="line-height:3;">
                                            <div>收货地址 <span>未选择收货地址</span></div>
                                        </div>
                                    @endif
                                </a>
                            </li>

                            <li style="background: #f2f2f2;height: 10px;"></li>
                            <li class="mui-table-view-cell time">
                                <div class="time_header">
                                    发货时间 <span class="mui-pull-right mui-text-green">卖家承诺24小时之内发货</span>
                                </div>
                                <div class="mui-dingdan-xx bg-fff flex">
                                    <img src="{{str2arr($goods->goods_images)[0]}}" alt="" class="mui-pull-left" />
                                    <div class="mui-pull-right">
                                        <h4>{{$goods->goods_name}}</h4>
                                        <div class="mui-text-left" style="position: relative;">
                                            <div style="margin-bottom: 10px;">￥<span>{{$goods->price}}</span> <span class="mui-pull-right">X{{$number}}</span></div>
                                            <!-- <div class="num_shu mui-clearfix">
                                                <button type="button" class=" del">-</button>
                                                <input class="mui-pull-left" type="text"   value="1" readonly />
                                                <button type="button" class=" add">+</button>
                                            </div> -->
                                            <input type="hidden" name="goods_id" value="{{$goods->goods_id}}">
                                            <input type="hidden" name="specs" value="{{$specs}}">
                                            <input type="hidden" name="number" value="{{$number}}">
                                        </div>
                                    </div>
                                </div>

                                <div class="time_bottom">邮费 <span class="mui-pull-right">{{config('shop.post_type')[$item->post_type]}}</span></div>
                                <div class="flex flexs">
                                    <div style="width: 100px;">订单备注：</div>
                                    <textarea name="remark" rows="" cols="" placeholder="请输入备注信息"></textarea>
                                </div>
                            </li>
                        </ul>
                        <div class="mui-title-header">支付方式</div>
                        <ul class="mui-table-view mui-table-view-radio bg-fff zhifu" style="margin-top: 0;">
                            @if($goods->goods_zone == 1 || $goods->goods_zone == 2)
                                <li class="mui-table-view-cell">
                                    <a href="javascript:;" class="mui-navigate-right">
                                        {{get_currency()['money1']}}
                                        <span style="float: right;color: red;margin-right: 30px;">余额{{$wallet->money1}}</span>
                                    </a>
                                </li>
                                @elseif($goods->goods_zone == 3)
                                    <li class="mui-table-view-cell">
                                        <a href="javascript:;" class="mui-navigate-right">
                                            {{get_currency()['money2']}}
                                            <span style="float: right;color: red;margin-right: 30px;">余额{{$wallet->money2}}</span>
                                        </a>
                                    </li>
                                @else
                                <li class="mui-table-view-cell">
                                    <a href="javascript:;" class="mui-navigate-right">
                                        {{get_currency()['money2']}}+ {{get_currency()['money1']}}
                                        <span style="float: right;color: red;margin-right: 30px;">余额{{$wallet->money2}}+{{$wallet->money1}}</span>
                                    </a>
                                </li>
                            @endif
                            {{--<li class="mui-table-view-cell mui-selected">
                                <a href="javascript:;" class="mui-navigate-right">
                                    <input type="radio" name="zhifu"  value="1" />
                                    <img src="images/zhufubao.png" alt="">支付宝支付
                                </a>
                            </li>
                            <li class="mui-table-view-cell">
                                <a href="javascript:;" class="mui-navigate-right">
                                    <input type="radio" name="zhifu"  value="2" />
                                    <img src="images/yinhangka.png" alt="">银行卡支付
                                </a>
                            </li>--}}
                        </ul>

                        @if($goods->goods_zone == 2)
                        <div class="mui-title-header">够买方式</div>
                        <ul class="mui-table-view mui-table-view-radio bg-fff zhifu" style="margin-top: 0;">
                            <li class="mui-table-view-cell">
                                <a href="javascript:;" class="mui-navigate-right">
                                    <input type="radio" name="buy_type"  value="0" />
                                    普通购物
                                </a>
                            </li>
                            <li class="mui-table-view-cell mui-selected">
                                <a href="javascript:;" class="mui-navigate-right">
                                    <input type="radio" name="buy_type"  value="1" checked/>
                                    代售
                                    <span style="float: right;color: red;margin-right: 30px;">+{{$goods->agent_price*$number}}</span>
                                </a>
                            </li>
                        </ul>
                        @endif
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="mui-bar mui-bar-footer" style=" height: 50px;">
        <div class="flex">
            <div class="flex-item">
                <div class="mui-text-red">￥ <b class="count mui-text-red">{{$goods->price*$number}}</b>
                     </div>
            </div>
            <div class="flex-item mui-text-right" id="submit-btn">
                <button class="mui-btns"  style="margin:0 -10px 0 0;background: #5a92fd;width: 90%;height: 50px;line-height: 50px;border-radius: 2px;float: right;">提交订单</button>
            </div>
        </div>
    </div>
@endsection
@push('scripts')
    <script>
        document.getElementById("submit-btn").addEventListener("tap", function() {
            mui.confirm('确认提交订单？','',function(e){
                if(e.index==1){
                    $('#order-create').submit();
                }
            })
        });
    </script>
@endpush